<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});


/*Route::prefix('cart')->middleware('client.credentials')->group(function(){
    \Illuminate\Support\Facades\Route::any('m',function (){
        return  111;
    });
});*/

Route::prefix('cart')->middleware('client.credentials')->group(function(){
    \Illuminate\Support\Facades\Route::any('m',function (){
        dump(auth('api')->user()->toArray());
        return  111;
    });
});
\Illuminate\Support\Facades\Route::get('home',function (){
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
    header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');
    return [
        'code'=>200,
        'msg'=>'',
        'post'=>[
            [
                'id'=>1,
                'title'=>'uni-app请求接口以及生命周期函数',
                'img'=>'https://img.inacorner.top/clearnullimg/2019/06/art-big-data-blur-373543.jpg',
            ],
            [
                'id'=>1,
                'title'=>'论坛建站程序Discuz安装教程',
                'img'=>'https://img.inacorner.top/clearnullimg/2019/06/image-20.png',
            ],
        ],
    ];
});

